<?php
class UserModel extends Model {
	// 自动验证设置
    	protected $_validate	 =	 array(
                array('verify','VerifyCode','验证码填写错误',1,'function'),
                array('user_name','require','请填写名称'),
                array('user_email','require','请填写邮箱。'),
		array('user_password','require','请填写密码'),
                array('user_email','email','邮箱格式错误。'),
                array('v_password','user_password','确认密码不正确',0,'confirm'),
		array('user_name','','名称已经存在！',1,'unique',1),
		array('user_email','','邮箱已经存在！',1,'unique',1),
		);
        
	// 自动填充设置
	protected $_auto	 =	 array(
                array('user_password','sha1',1,'function'),
				array('reg_dt','time',1,'function'),
				array('email_activation','0',1),
				array('email_key','GetEmailKey',1,'callback'),
		);
	protected $readonlyField = array('user_name');

	function GetEmailKey()
	{
		$strKey = $_POST['user_email'] ;
		$strKey .= time();
		$strKey = sha1($strKey);
		return $strKey;
	}

}
?>